# Maintainer: Alberto Fanjul Alonso <albfan@gnome.org>

_realname=granite
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=6.2.0
pkgrel=1
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
pkgdesc="git repository viewer for GTK+/GNOME (mingw-w64)"
depends=( "${MINGW_PACKAGE_PREFIX}-libgee"
          "${MINGW_PACKAGE_PREFIX}-gtk3")
makedepends=("${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-vala"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-itstool"
             "${MINGW_PACKAGE_PREFIX}-cc")
options=('strip')
license=("GPL3")
url="https://github.com/elementary/granite"
source=("${_realname}-${pkgver}.tar.gz::https://github.com/elementary/${_realname}/archive/refs/tags/${pkgver}.tar.gz")
sha256sums=('067d31445da9808a802fca523630c3e4b84d2d7c78ae547ced017cb7f3b9c6b5')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"

}

build() {
  [[ -d build-${MINGW_CHOST} ]] && rm -rf build-${MINGW_CHOST}
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  meson \
    --prefix="${MINGW_PREFIX}" \
    --buildtype plain \
    -Dwerror=false \
    ../${_realname}-${pkgver}

  ninja
}

package() {
  cd "$srcdir/build-${MINGW_CHOST}"
  DESTDIR="${pkgdir}" ninja install

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
